package cn.kgm.enums;

public enum ColorEnums {

    RED("RED", 1),
    BLUE("BLUE", 2),
    GRENN("GRENN", 3),
    ;

    private Integer code;
    private String color;

    ColorEnums(String color, Integer code) {
        this.code = code;
        this.color = color;
    }

    public static ColorEnums getByColor(String color) {
        for (ColorEnums value : ColorEnums.values()) {
            if (value.getColor().equals(color))
                return value;
        }
        return null;
    }

    public Integer getCode() {
        return code;
    }

    public String getColor() {
        return color;
    }
}
